<?php
// admin users edit page
require_once 'view/adm/users/administrators.index.php';
require_once 'control/adm/users/administrators/form.php';

class AdministratorsActivatePage extends PageController {

	var $form;

    function AdministratorsActivatePage() {
        parent::PageController();
        $this->form =& new AdminUsersFormController();
        $this->registerOnLoadListener(new Delegate($this, 'load'));
        $this->addChild('UserForm', $this->form);
        $this->setDefaultChild('UserForm');

        //$listview =& new AdminUsersListView('/adm/users/administrators.index.html');
        $this->setDefaultView(new Handle('AdminUsersListView', array('/adm/users/administrators.index.html')));
        //$listview =& new AdminUsersListView('/adm/users/test.html');
        //$this->addView('index', $listview);

        //$this->setDefaultView('index');

        $this->addView('success', WACT_DEFAULT_VIEW);
        $this->addView('notfound', WACT_DEFAULT_VIEW);


        $this->registerOnActivateListener(new Delegate($this, 'guard'));
     }

     function guard(&$source, &$request, &$responseModel) {
      if (!$request->hasParameter('user_id')) {
            return 'notfound';
        }
     }

     function load(&$source, &$request, &$responseModel) {
     	$this->form->activate($source, $request, $responseModel);
     	return 'success';
     }
}

?>